package com.itheima.ood.lambda.demo05;

import java.util.Random;

public class RandomNumHandlerDemo {

    public static void main(String[] args) {

        int i1 = useRandomNumHandler(() -> {

            Random random = new Random();
            int i = random.nextInt(9);
            return i;
        });
        System.out.println(i1);
    }

    //方法有没有返回值都行
    public static int useRandomNumHandler(RandomNumHandler randomNumHandler){

        return randomNumHandler.getRandom();
    }
}
